package com.ai.networking.netty.serverDynamicsLink;

import lombok.Data;
import lombok.Getter;

import java.util.Observable;

/**
 * 利用观察者模式实现动态的链路增加
 * @Author jiaok
 * @Date 2024-05-13 15:26
 */
@Data
@Getter
public class LinkDynamicsTheme extends Observable {

    /**
     * 链路ip
     */
    private String linkIp;

    /**
     * 链路port
     */
    private Integer linkPort;

    public void detectionLinkChange(){
        setChanged();
        notifyObservers();;
    }


    public void setLinkDynamicsData(String linkIp, Integer linkPort) {
        this.linkIp = linkIp;
        this.linkPort = linkPort;
        //通知变化
        detectionLinkChange();
    }
}
